package com.care.ui;

import java.util.List;

public class KnowledgePage<K> {
	private List<K> list;
	private int pageNum;//当前页
	private int pageSize;//每页显示条数
	private int prePageNum;//上一页
	private int nextPageNum;//下一页
	private int totalPage;//总页数
	private int totalcount;//总数据
	
	public KnowledgePage(int pageNum, int pageSize) {
		super();
		this.pageNum = pageNum;
		this.pageSize = pageSize;
	}
	public KnowledgePage() {
		super();
		// TODO Auto-generated constructor stub
	}
	public List<K> getList() {
		return list;
	}
	public void setList(List<K> list) {
		this.list = list;
	}
	public int getPageNum() {
		return pageNum;
	}
	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getPrePageNum() {
		return prePageNum;
	}
	public void setPrePageNum(int prePageNum) {
		this.prePageNum = prePageNum;
	}
	public int getNextPageNum() {
		return nextPageNum;
	}
	public void setNextPageNum(int nextPageNum) {
		this.nextPageNum = nextPageNum;
	}
	public int getTotalPage() {
		return totalPage;
	}
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	public int getTotalcount() {
		return totalcount;
	}
	public void setTotalcount(int totalcount) {
		this.totalcount = totalcount;
		if(totalcount%pageSize==0){
			totalPage=totalcount/pageSize;			
		}
		else {
			totalPage=totalcount/pageSize+1;
		}
		if(pageNum>1){
			prePageNum=pageNum-1;
		}
		else {
			prePageNum=1;
		}
		if (pageNum<totalPage) {
			if (pageNum==0) {
				pageNum=pageNum+1;
			}
			else {
				pageNum=pageNum;
			}
			nextPageNum=pageNum+1;
		}
		else {
			nextPageNum=totalPage;
		}
	}
	
	
}
